package main

import (
	"time"

	"github.com/beevik/etree"
)

// MaxiNumDate 9999/12/31
var MaxiNumDate = time.Date(9999, 12, 31, 0, 0, 0, 0, time.Local)

// MiniNumDate 1752/9/14
var MiniNumDate = time.Date(1752, 9, 14, 0, 0, 0, 0, time.Local)
var MaxSize = ElementSize{
	Width:  16777215,
	Height: 16777215,
}
var MinSize = ElementSize{Width: 0, Height: 0}

type WindowUiProperty struct {
	X, Y, Width, Height int
	Title               string
	Ele                 []*etree.Element `json:"-"`
}

type WindowUi struct {
	Property WindowUiProperty
	Menu     []*Menu
	Elements []*WindowUiElement
}
type WindowUiElement struct {
	Tag      string
	Name     string
	Layout   string
	Class    string
	Ele      *etree.Element  `json:"-"`
	Property ElementProperty //`json:"-"`
	Elements []*WindowUiElement
}

type ElementBounds struct {
	X, Y, Width, Height int
}

type ElementProperty struct {
	MaxSize   ElementSize
	MinSize   ElementSize
	Size      ElementSize
	Font      ElementFont
	Text      string
	Enabled   bool
	Visible   bool
	Checkable bool
	Checked   bool
	ReadOnly  bool

	Bounds ElementBounds

	//layout grid
	Row, Column, RowSpan, ColumnSpan int

	AttributeTitle string

	CurrentIndex int

	LayoutLeftMargin, LayoutRightMargin, LayoutTopMargin, LayoutBottomMargin int
	LayoutVerticalSpacing, LayoutHorizontalSpacing                           int

	ToolTip string

	Alignment string

	SelectMode string

	Editable bool

	TextAlignment string

	EchoMode string

	MaxiNum, MiniMun, Step int

	Value int

	DisplayFormat string

	Orientation string
	// json number
	MaxiNumDate time.Time `json:"-"`
	MiniNumDate time.Time `json:"-"`
	Date        time.Time `json:"-"`
}

type ElementSize struct {
	Width, Height int
}

type ElementFont struct {
	Family string
	Point  int
}
type MenuElement struct {
	Menu *Menu
	Ele  *etree.Element `json:"-"`
}
type Menu struct {
	Title    string
	Name     string
	Elements []*Menu
	// json ignore
	Ele *etree.Element `json:"-"`
}
